package com.voygern.task1.dao.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.voygern.task1.model.User;

public interface UserDaoMapper {
	@Select("select id,create_at,update_at,username from UserTable")
      List<User> queryAll();
	@Insert("insert into UserTable (id,create_at,update_at,username) values (#{id},#{create_at},#{update_at},#{username})")
	  int add(User user);
	@Delete("delete from UserTable where id=#{id} ")
      int deleteUserById(@Param("id")long id);
	@Update("update UserTable set update_at=#{update_at} where username = #{name}")
	  int changeUpdateAtByUsername(@Param("name")String name, @Param("update_at")long update_at);
	@Select("select id,create_at,update_at,username from UserTable where id=#{id}")
	  User queryUserById(@Param("id")int id);
}
